<template>
<div>

  <div class="chain-link-bar-wrapper">
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item>采购管理</el-breadcrumb-item>
      <el-breadcrumb-item to="/procurement">采购列表</el-breadcrumb-item>
      <el-breadcrumb-item :to="'/procurement/detail/' + procurement.id">详情：{{procurement.product_name}}</el-breadcrumb-item>
    </el-breadcrumb>
  </div>

  <el-card class="box-card">

    <div slot="header" class="clearfix">
      <h3 class="app-h3 app-margin-v-0">
        采购详情
      </h3>
    </div>

    <div class="app-diliver-10"></div>

    <el-row :gutter="80">
      <el-col :span="12">

        <el-row>
          <el-col :span="24">
            <h4 class="app-h4 app-margin-v-0">采购信息</h4>
          </el-col>
        </el-row>

        <div class="app-diliver-10"></div>

        <el-row class="app-section">

          <el-col :span="3">
            <span class="app-label">采购方式：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{procurement.company_name}}&nbsp;</span>
          </el-col>
            <el-col :span="3">
                <span class="app-label">联系人：</span>
            </el-col>
            <el-col :span="20">
                <span class="app-text">{{procurement.contact_name}}&nbsp;</span>
            </el-col>

            <el-col :span="3">
                <span class="app-label">联系电话：</span>
            </el-col>
            <el-col :span="20">
                <span class="app-text">{{procurement.contact_phone}}&nbsp;</span>
            </el-col>

            <el-col :span="3">
                <span class="app-label">联系邮箱：</span>
            </el-col>
            <el-col :span="20">
                <span class="app-text">{{procurement.contact_email}}&nbsp;</span>
            </el-col>
          <el-col :span="3">
            <span class="app-label">产品名称：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{procurement.product_name}}&nbsp;</span>
          </el-col>

          <el-col :span="3">
            <span class="app-label">产品描述：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{procurement.product_description}}&nbsp;</span>
          </el-col>

          <el-col :span="3">
            <span class="app-label">购买数量：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{procurement.buy_number}}&nbsp;</span>
          </el-col>

          <el-col :span="3">
            <span class="app-label">所属行业：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{procurement.product_industry_name}}&nbsp;</span>
          </el-col>

          <el-col :span="3">
            <span class="app-label">收货地址：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{procurement.province+procurement.city+procurement.address}}&nbsp;</span>
          </el-col>
          <el-col :span="3">
            <span class="app-label">有效时间：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{procurement.start_date_time_str}} ~ {{procurement.end_date_time_str}}&nbsp;</span>
          </el-col>

          <el-col :span="3">
            <span class="app-label">产品图片：</span>
          </el-col>
          <el-col :span="20">
            <el-image :preview-src-list="procurement.displayImgList" class="section-img-200" v-for="img in procurement.displayImgList" :src="img" />
            &nbsp;
          </el-col>


        </el-row>

      </el-col>

      <el-col :span="12">
        <el-row>
          <el-col :span="24">
            <h4 class="app-h4 app-margin-v-0">审核状态</h4>
          </el-col>
        </el-row>

        <div class="app-diliver-10"></div>

        <el-row class="app-section">
          <el-col :span="3">
            <span class="app-label">状态：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">            
              <el-button v-if="procurement.check_status == 'NOT'"  size="mini">未审核</el-button>
              <el-button v-if="procurement.check_status == 'PASS'" type="success"  size="mini">已通过</el-button>
              <el-button v-if="procurement.check_status == 'FAIL'" type="danger"  size="mini">未通过</el-button>&nbsp;
              &nbsp;&nbsp;&nbsp;
              <el-button v-if="procurement.is_time_out == 1"  size="mini" type="danger">已结束</el-button>
              <el-button v-if="procurement.is_time_out == 0"  size="mini" type="success">未结束</el-button>
            </span>
          </el-col>

          <el-col :span="3">
            <span class="app-label">审核说明：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{procurement.check_status_explain}}&nbsp;</span>
          </el-col>

          <el-col :span="3">
            <span class="app-label">审核时间：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{procurement.check_date_time_str}}&nbsp;</span>
          </el-col>

          <el-col :span="3">
            <span class="app-label">发布时间：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{procurement.add_date_time_str}}&nbsp;</span>
          </el-col>

          <el-col :span="3">
            <span class="app-label">更新时间：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{procurement.update_date_time_str}}&nbsp;</span>
          </el-col>

        </el-row>

        <el-row>
          <el-col :span="24">
            <h4 class="app-h4 app-margin-b-0">个人信息 & 公司信息</h4>
          </el-col>
        </el-row>

        <div class="app-diliver-10"></div>

        <el-row class="app-section">
          <el-col :span="3">
            <span class="app-label">发布人：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{account.last_name + account.first_name}}</span>
          </el-col>
          <el-col :span="3">
            <span class="app-label">手机号：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{account.phone}}</span>
          </el-col>
          <el-col :span="3">
            <span class="app-label">公司名称：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{company.name}}</span>
          </el-col>
          <el-col :span="3">
            <span class="app-label">公司座机：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{company.company_tel == null || company.company_tel == '' ? "暂无座机" : company.company_tel}}</span>
          </el-col>
          <el-col :span="3">
            <span class="app-label">公司地址：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">
              {{company.address_detail}}&nbsp;
            </span>
          </el-col>


        </el-row>


      </el-col>

    </el-row>



  </el-card>

</div>
</template>


<script>

  import NcButton from '../common/NcButton'
  import SubmitButton from '../common/SubmitButton'

  import Api from '../../api/Api'
  import ProcurementApi from '../../api/ProcurementApi'



  export default {
  	components: {
  		NcButton, SubmitButton
  	},
  	data(){
  	  return {

        procurement: {},
        account: {},
        company: {},
        procurementId: 0,

  	  }
  	},
  	computed: {

  	},
  	created(){
  	  this.procurementId = this.$route.params.procurementId;
      this.getProcurement();
  	},
    watch: {
      '$route' (to, from) {
        this.procurementId = to.params.procurementId;
        this.getProcurement();
      }
    },
  	methods: {
      getProcurement(){
        ProcurementApi.detail(this.procurementId, json => {
          this.procurement = json.procurement;
          this.account = json.procurement.account;
          this.company = json.procurement.company;
        });
      }
  	}
  }
</script>

